<!DOCTYPE html>
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  <meta name="description" content="刘清政">
  <meta name="keyword" content="hexo-theme">
  
    <link rel="shortcut icon" href="/css/images/logo.png">
  
  <title>
    
      python/路飞项目/3-登录注册/8-前台登录注册修订 | Justin-刘清政的博客
    
  </title>
  <link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
  <link href="//cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.css" rel="stylesheet">
  <link href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/tomorrow.min.css" rel="stylesheet">
  
<link rel="stylesheet" href="/css/style.css">

  
    
<link rel="stylesheet" href="/css/plugins/gitment.css">

  
  <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/geopattern/1.2.3/js/geopattern.min.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.js"></script>
  
    
<script src="/js/qrious.js"></script>

  
  
    
<script src="/js/gitment.js"></script>

  
  

  
<meta name="generator" content="Hexo 4.2.0"></head>
<div class="wechat-share">
  <img src="/css/images/logo.png" />
</div>

  <body>
    <header class="header fixed-header">
  <div class="header-container">
    <a class="home-link" href="/">
      <div class="logo"></div>
      <span>Justin-刘清政的博客</span>
    </a>
    <ul class="right-list">
      
        <li class="list-item">
          
            <a href="/" class="item-link">主页</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/tags/" class="item-link">标签</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/archives/" class="item-link">归档</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/about/" class="item-link">关于我</a>
          
        </li>
      
    </ul>
    <div class="menu">
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </div>
    <div class="menu-mask">
      <ul class="menu-list">
        
          <li class="menu-item">
            
              <a href="/" class="menu-link">主页</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/tags/" class="menu-link">标签</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/archives/" class="menu-link">归档</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/about/" class="menu-link">关于我</a>
            
          </li>
        
      </ul>
    </div>
  </div>
</header>

    <div id="article-banner">
  <h2>python/路飞项目/3-登录注册/8-前台登录注册修订</h2>



  <p class="post-date">2020-03-02</p>
    <!-- 不蒜子统计 -->
    <span id="busuanzi_container_page_pv" style='display:none' class="">
        <i class="icon-smile icon"></i> 阅读数：<span id="busuanzi_value_page_pv"></span>次
    </span>
  <div class="arrow-down">
    <a href="javascript:;"></a>
  </div>
</div>
<main class="app-body flex-box">
  <!-- Article START -->
  <article class="post-article">
    <section class="markdown-content"><h2 id="前台"><a href="#前台" class="headerlink" title="前台"></a>前台</h2><h5 id="Login-vue"><a href="#Login-vue" class="headerlink" title="Login.vue"></a>Login.vue</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br><span class="line">289</span><br><span class="line">290</span><br><span class="line">291</span><br><span class="line">292</span><br><span class="line">293</span><br><span class="line">294</span><br><span class="line">295</span><br><span class="line">296</span><br><span class="line">297</span><br><span class="line">298</span><br><span class="line">299</span><br><span class="line">300</span><br><span class="line">301</span><br><span class="line">302</span><br><span class="line">303</span><br><span class="line">304</span><br><span class="line">305</span><br><span class="line">306</span><br><span class="line">307</span><br><span class="line">308</span><br><span class="line">309</span><br><span class="line">310</span><br><span class="line">311</span><br><span class="line">312</span><br><span class="line">313</span><br><span class="line">314</span><br><span class="line">315</span><br><span class="line">316</span><br><span class="line">317</span><br><span class="line">318</span><br><span class="line">319</span><br><span class="line">320</span><br><span class="line">321</span><br><span class="line">322</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line">    &lt;div class&#x3D;&quot;login&quot;&gt;</span><br><span class="line">        &lt;div class&#x3D;&quot;box&quot;&gt;</span><br><span class="line">            &lt;i class&#x3D;&quot;el-icon-close&quot; @click&#x3D;&quot;close_login&quot;&gt;&lt;&#x2F;i&gt;</span><br><span class="line">            &lt;div class&#x3D;&quot;content&quot;&gt;</span><br><span class="line">                &lt;div class&#x3D;&quot;nav&quot;&gt;</span><br><span class="line">                    &lt;span :class&#x3D;&quot;&#123;active: login_method &#x3D;&#x3D;&#x3D; &#39;is_pwd&#39;&#125;&quot;</span><br><span class="line">                          @click&#x3D;&quot;change_login_method(&#39;is_pwd&#39;)&quot;&gt;密码登录&lt;&#x2F;span&gt;</span><br><span class="line">                    &lt;span :class&#x3D;&quot;&#123;active: login_method &#x3D;&#x3D;&#x3D; &#39;is_sms&#39;&#125;&quot;</span><br><span class="line">                          @click&#x3D;&quot;change_login_method(&#39;is_sms&#39;)&quot;&gt;短信登录&lt;&#x2F;span&gt;</span><br><span class="line">                &lt;&#x2F;div&gt;</span><br><span class="line"></span><br><span class="line">                &lt;el-form v-if&#x3D;&quot;login_method &#x3D;&#x3D;&#x3D; &#39;is_pwd&#39;&quot;&gt;</span><br><span class="line">                    &lt;el-input</span><br><span class="line">                            placeholder&#x3D;&quot;用户名&#x2F;手机号&#x2F;邮箱&quot;</span><br><span class="line">                            prefix-icon&#x3D;&quot;el-icon-user&quot;</span><br><span class="line">                            v-model&#x3D;&quot;username&quot;</span><br><span class="line">                            clearable&gt;</span><br><span class="line">                    &lt;&#x2F;el-input&gt;</span><br><span class="line">                    &lt;el-input</span><br><span class="line">                            placeholder&#x3D;&quot;密码&quot;</span><br><span class="line">                            prefix-icon&#x3D;&quot;el-icon-key&quot;</span><br><span class="line">                            v-model&#x3D;&quot;password&quot;</span><br><span class="line">                            clearable</span><br><span class="line">                            show-password&gt;</span><br><span class="line">                    &lt;&#x2F;el-input&gt;</span><br><span class="line">                    &lt;el-button type&#x3D;&quot;primary&quot; @click&#x3D;&quot;login&quot;&gt;登录&lt;&#x2F;el-button&gt;</span><br><span class="line">                &lt;&#x2F;el-form&gt;</span><br><span class="line"></span><br><span class="line">                &lt;el-form v-if&#x3D;&quot;login_method &#x3D;&#x3D;&#x3D; &#39;is_sms&#39;&quot;&gt;</span><br><span class="line">                    &lt;el-input</span><br><span class="line">                            placeholder&#x3D;&quot;手机号&quot;</span><br><span class="line">                            prefix-icon&#x3D;&quot;el-icon-phone-outline&quot;</span><br><span class="line">                            v-model&#x3D;&quot;mobile&quot;</span><br><span class="line">                            clearable</span><br><span class="line">                            @blur&#x3D;&quot;check_mobile&quot;&gt;</span><br><span class="line">                    &lt;&#x2F;el-input&gt;</span><br><span class="line">                    &lt;el-input</span><br><span class="line">                            placeholder&#x3D;&quot;验证码&quot;</span><br><span class="line">                            prefix-icon&#x3D;&quot;el-icon-chat-line-round&quot;</span><br><span class="line">                            v-model&#x3D;&quot;sms&quot;</span><br><span class="line">                            clearable&gt;</span><br><span class="line">                        &lt;template slot&#x3D;&quot;append&quot;&gt;</span><br><span class="line">                            &lt;span class&#x3D;&quot;sms&quot; @click&#x3D;&quot;send_sms&quot;&gt;&#123;&#123; sms_interval &#125;&#125;&lt;&#x2F;span&gt;</span><br><span class="line">                        &lt;&#x2F;template&gt;</span><br><span class="line">                    &lt;&#x2F;el-input&gt;</span><br><span class="line">                    &lt;el-button @click&#x3D;&quot;mobile_login&quot; type&#x3D;&quot;primary&quot;&gt;登录&lt;&#x2F;el-button&gt;</span><br><span class="line">                &lt;&#x2F;el-form&gt;</span><br><span class="line"></span><br><span class="line">                &lt;div class&#x3D;&quot;foot&quot;&gt;</span><br><span class="line">                    &lt;span @click&#x3D;&quot;go_register&quot;&gt;立即注册&lt;&#x2F;span&gt;</span><br><span class="line">                &lt;&#x2F;div&gt;</span><br><span class="line">            &lt;&#x2F;div&gt;</span><br><span class="line">        &lt;&#x2F;div&gt;</span><br><span class="line">    &lt;&#x2F;div&gt;</span><br><span class="line">&lt;&#x2F;template&gt;</span><br><span class="line"></span><br><span class="line">&lt;script&gt;</span><br><span class="line">    export default &#123;</span><br><span class="line">        name: &quot;Login&quot;,</span><br><span class="line">        data() &#123;</span><br><span class="line">            return &#123;</span><br><span class="line">                username: &#39;&#39;,</span><br><span class="line">                password: &#39;&#39;,</span><br><span class="line">                mobile: &#39;&#39;,</span><br><span class="line">                sms: &#39;&#39;,  &#x2F;&#x2F; 验证码</span><br><span class="line">                login_method: &#39;is_pwd&#39;,</span><br><span class="line">                sms_interval: &#39;获取验证码&#39;,</span><br><span class="line">                is_send: false,</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;,</span><br><span class="line">        methods: &#123;</span><br><span class="line">            close_login() &#123;</span><br><span class="line">                this.$emit(&#39;close&#39;)</span><br><span class="line">            &#125;,</span><br><span class="line">            go_register() &#123;</span><br><span class="line">                this.$emit(&#39;go&#39;)</span><br><span class="line">            &#125;,</span><br><span class="line">            change_login_method(method) &#123;</span><br><span class="line">                this.login_method &#x3D; method;</span><br><span class="line">            &#125;,</span><br><span class="line">            check_mobile() &#123;</span><br><span class="line">                if (!this.mobile) return;</span><br><span class="line">                &#x2F;&#x2F; js正则：&#x2F;正则语法&#x2F;</span><br><span class="line">                &#x2F;&#x2F; &#39;字符串&#39;.match(&#x2F;正则语法&#x2F;)</span><br><span class="line">                if (!this.mobile.match(&#x2F;^1[3-9][0-9]&#123;9&#125;$&#x2F;)) &#123;</span><br><span class="line">                    this.$message(&#123;</span><br><span class="line">                        message: &#39;手机号有误&#39;,</span><br><span class="line">                        type: &#39;warning&#39;,</span><br><span class="line">                        duration: 1000,</span><br><span class="line">                        onClose: () &#x3D;&gt; &#123;</span><br><span class="line">                            this.mobile &#x3D; &#39;&#39;;</span><br><span class="line">                        &#125;</span><br><span class="line">                    &#125;);</span><br><span class="line">                    return false;</span><br><span class="line">                &#125;</span><br><span class="line">                &#x2F;&#x2F; 后台校验手机号是否已存在</span><br><span class="line">                this.$axios(&#123;</span><br><span class="line">                    url: this.$settings.base_url + &#39;&#x2F;user&#x2F;mobile&#x2F;&#39;,</span><br><span class="line">                    method: &#39;post&#39;,</span><br><span class="line">                    data: &#123;</span><br><span class="line">                        mobile: this.mobile</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;).then(response &#x3D;&gt; &#123;</span><br><span class="line">                    let result &#x3D; response.data.result;</span><br><span class="line">                    if (result) &#123;</span><br><span class="line">                        this.$message(&#123;</span><br><span class="line">                            message: &#39;账号正常&#39;,</span><br><span class="line">                            type: &#39;success&#39;,</span><br><span class="line">                            duration: 1000,</span><br><span class="line">                        &#125;);</span><br><span class="line">                        &#x2F;&#x2F; 发生验证码按钮才可以被点击</span><br><span class="line">                        this.is_send &#x3D; true;</span><br><span class="line">                    &#125; else &#123;</span><br><span class="line">                        this.$message(&#123;</span><br><span class="line">                            message: &#39;账号不存在&#39;,</span><br><span class="line">                            type: &#39;warning&#39;,</span><br><span class="line">                            duration: 1000,</span><br><span class="line">                            onClose: () &#x3D;&gt; &#123;</span><br><span class="line">                                this.mobile &#x3D; &#39;&#39;;</span><br><span class="line">                            &#125;</span><br><span class="line">                        &#125;)</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;).catch(() &#x3D;&gt; &#123;</span><br><span class="line">                &#125;);</span><br><span class="line">            &#125;,</span><br><span class="line">            send_sms() &#123;</span><br><span class="line">                &#x2F;&#x2F; this.is_send必须允许发生验证码，才可以往下执行逻辑</span><br><span class="line">                if (!this.is_send) return;</span><br><span class="line">                &#x2F;&#x2F; 按钮点一次立即禁用</span><br><span class="line">                this.is_send &#x3D; false;</span><br><span class="line"></span><br><span class="line">                let sms_interval_time &#x3D; 60;</span><br><span class="line">                this.sms_interval &#x3D; &quot;发送中...&quot;;</span><br><span class="line"></span><br><span class="line">                &#x2F;&#x2F; 定时器: setInterval(fn, time, args)</span><br><span class="line"></span><br><span class="line">                &#x2F;&#x2F; 往后台发送验证码</span><br><span class="line">                this.$axios(&#123;</span><br><span class="line">                    url: this.$settings.base_url + &#39;&#x2F;user&#x2F;sms&#x2F;&#39;,</span><br><span class="line">                    method: &#39;get&#39;,</span><br><span class="line">                    params: &#123;</span><br><span class="line">                        mobile: this.mobile</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;).then(response &#x3D;&gt; &#123;</span><br><span class="line">                    let result &#x3D; response.data.result;</span><br><span class="line">                    if (result) &#123; &#x2F;&#x2F; 发送成功</span><br><span class="line">                        let timer &#x3D; setInterval(() &#x3D;&gt; &#123;</span><br><span class="line">                            if (sms_interval_time &lt;&#x3D; 1) &#123;</span><br><span class="line">                                clearInterval(timer);</span><br><span class="line">                                this.sms_interval &#x3D; &quot;获取验证码&quot;;</span><br><span class="line">                                this.is_send &#x3D; true; &#x2F;&#x2F; 重新回复点击发送功能的条件</span><br><span class="line">                            &#125; else &#123;</span><br><span class="line">                                sms_interval_time -&#x3D; 1;</span><br><span class="line">                                this.sms_interval &#x3D; &#96;$&#123;sms_interval_time&#125;秒后再发&#96;;</span><br><span class="line">                            &#125;</span><br><span class="line">                        &#125;, 1000);</span><br><span class="line">                    &#125; else &#123;  &#x2F;&#x2F; 发送失败</span><br><span class="line">                        this.sms_interval &#x3D; &quot;重新获取&quot;;</span><br><span class="line">                        this.is_send &#x3D; true;</span><br><span class="line">                        this.$message(&#123;</span><br><span class="line">                            message: &#39;短信发送失败&#39;,</span><br><span class="line">                            type: &#39;warning&#39;,</span><br><span class="line">                            duration: 3000</span><br><span class="line">                        &#125;);</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;).catch(() &#x3D;&gt; &#123;</span><br><span class="line">                    this.sms_interval &#x3D; &quot;频率过快&quot;;</span><br><span class="line">                    this.is_send &#x3D; true;</span><br><span class="line">                &#125;)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">            &#125;,</span><br><span class="line">            login() &#123;</span><br><span class="line">                if (!(this.username &amp;&amp; this.password)) &#123;</span><br><span class="line">                    this.$message(&#123;</span><br><span class="line">                        message: &#39;请填好账号密码&#39;,</span><br><span class="line">                        type: &#39;warning&#39;,</span><br><span class="line">                        duration: 1500</span><br><span class="line">                    &#125;);</span><br><span class="line">                    return false  &#x2F;&#x2F; 直接结束逻辑</span><br><span class="line">                &#125;</span><br><span class="line"></span><br><span class="line">                this.$axios(&#123;</span><br><span class="line">                    url: this.$settings.base_url + &#39;&#x2F;user&#x2F;login&#x2F;&#39;,</span><br><span class="line">                    method: &#39;post&#39;,</span><br><span class="line">                    data: &#123;</span><br><span class="line">                        username: this.username,</span><br><span class="line">                        password: this.password,</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;).then(response &#x3D;&gt; &#123;</span><br><span class="line">                    let username &#x3D; response.data.result.username;</span><br><span class="line">                    let token &#x3D; response.data.result.token;</span><br><span class="line">                    let user_id &#x3D; response.data.result.id;</span><br><span class="line">                    this.$cookies.set(&#39;username&#39;, username, &#39;7d&#39;);</span><br><span class="line">                    this.$cookies.set(&#39;token&#39;, token, &#39;7d&#39;);</span><br><span class="line">                    this.$cookies.set(&#39;user_id&#39;, user_id, &#39;7d&#39;);</span><br><span class="line">                    this.$emit(&#39;success&#39;, response.data.result);</span><br><span class="line">                &#125;).catch(error &#x3D;&gt; &#123;</span><br><span class="line">                    console.log(error.response.data)</span><br><span class="line">                &#125;)</span><br><span class="line">            &#125;,</span><br><span class="line">            mobile_login () &#123;</span><br><span class="line">                if (!(this.mobile &amp;&amp; this.sms)) &#123;</span><br><span class="line">                    this.$message(&#123;</span><br><span class="line">                        message: &#39;请填好手机与验证码&#39;,</span><br><span class="line">                        type: &#39;warning&#39;,</span><br><span class="line">                        duration: 1500</span><br><span class="line">                    &#125;);</span><br><span class="line">                    return false  &#x2F;&#x2F; 直接结束逻辑</span><br><span class="line">                &#125;</span><br><span class="line"></span><br><span class="line">                this.$axios(&#123;</span><br><span class="line">                    url: this.$settings.base_url + &#39;&#x2F;user&#x2F;mobile&#x2F;login&#x2F;&#39;,</span><br><span class="line">                    method: &#39;post&#39;,</span><br><span class="line">                    data: &#123;</span><br><span class="line">                        mobile: this.mobile,</span><br><span class="line">                        code: this.sms,</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;).then(response &#x3D;&gt; &#123;</span><br><span class="line">                    let username &#x3D; response.data.result.username;</span><br><span class="line">                    let token &#x3D; response.data.result.token;</span><br><span class="line">                    let user_id &#x3D; response.data.result.id;</span><br><span class="line">                    this.$cookies.set(&#39;username&#39;, username, &#39;7d&#39;);</span><br><span class="line">                    this.$cookies.set(&#39;token&#39;, token, &#39;7d&#39;);</span><br><span class="line">                    this.$cookies.set(&#39;user_id&#39;, user_id, &#39;7d&#39;);</span><br><span class="line">                    this.$emit(&#39;success&#39;, response.data.result);</span><br><span class="line">                &#125;).catch(error &#x3D;&gt; &#123;</span><br><span class="line">                    console.log(error.response.data)</span><br><span class="line">                &#125;)</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&lt;&#x2F;script&gt;</span><br><span class="line"></span><br><span class="line">&lt;style scoped&gt;</span><br><span class="line">    .login &#123;</span><br><span class="line">        width: 100vw;</span><br><span class="line">        height: 100vh;</span><br><span class="line">        position: fixed;</span><br><span class="line">        top: 0;</span><br><span class="line">        left: 0;</span><br><span class="line">        z-index: 10;</span><br><span class="line">        background-color: rgba(0, 0, 0, 0.3);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .box &#123;</span><br><span class="line">        width: 400px;</span><br><span class="line">        height: 420px;</span><br><span class="line">        background-color: white;</span><br><span class="line">        border-radius: 10px;</span><br><span class="line">        position: relative;</span><br><span class="line">        top: calc(50vh - 210px);</span><br><span class="line">        left: calc(50vw - 200px);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .el-icon-close &#123;</span><br><span class="line">        position: absolute;</span><br><span class="line">        font-weight: bold;</span><br><span class="line">        font-size: 20px;</span><br><span class="line">        top: 10px;</span><br><span class="line">        right: 10px;</span><br><span class="line">        cursor: pointer;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .el-icon-close:hover &#123;</span><br><span class="line">        color: darkred;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .content &#123;</span><br><span class="line">        position: absolute;</span><br><span class="line">        top: 40px;</span><br><span class="line">        width: 280px;</span><br><span class="line">        left: 60px;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .nav &#123;</span><br><span class="line">        font-size: 20px;</span><br><span class="line">        height: 38px;</span><br><span class="line">        border-bottom: 2px solid darkgrey;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .nav &gt; span &#123;</span><br><span class="line">        margin: 0 20px 0 35px;</span><br><span class="line">        color: darkgrey;</span><br><span class="line">        user-select: none;</span><br><span class="line">        cursor: pointer;</span><br><span class="line">        padding-bottom: 10px;</span><br><span class="line">        border-bottom: 2px solid darkgrey;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .nav &gt; span.active &#123;</span><br><span class="line">        color: black;</span><br><span class="line">        border-bottom: 3px solid black;</span><br><span class="line">        padding-bottom: 9px;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .el-input, .el-button &#123;</span><br><span class="line">        margin-top: 40px;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .el-button &#123;</span><br><span class="line">        width: 100%;</span><br><span class="line">        font-size: 18px;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .foot &gt; span &#123;</span><br><span class="line">        float: right;</span><br><span class="line">        margin-top: 20px;</span><br><span class="line">        color: orange;</span><br><span class="line">        cursor: pointer;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .sms &#123;</span><br><span class="line">        color: orange;</span><br><span class="line">        cursor: pointer;</span><br><span class="line">        display: inline-block;</span><br><span class="line">        width: 70px;</span><br><span class="line">        text-align: center;</span><br><span class="line">        user-select: none;</span><br><span class="line">    &#125;</span><br><span class="line">&lt;&#x2F;style&gt;</span><br></pre></td></tr></table></figure>

<h5 id="Register-vue"><a href="#Register-vue" class="headerlink" title="Register.vue"></a>Register.vue</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line">    &lt;div class&#x3D;&quot;register&quot;&gt;</span><br><span class="line">        &lt;div class&#x3D;&quot;box&quot;&gt;</span><br><span class="line">            &lt;i class&#x3D;&quot;el-icon-close&quot; @click&#x3D;&quot;close_register&quot;&gt;&lt;&#x2F;i&gt;</span><br><span class="line">            &lt;div class&#x3D;&quot;content&quot;&gt;</span><br><span class="line">                &lt;div class&#x3D;&quot;nav&quot;&gt;</span><br><span class="line">                    &lt;span class&#x3D;&quot;active&quot;&gt;新用户注册&lt;&#x2F;span&gt;</span><br><span class="line">                &lt;&#x2F;div&gt;</span><br><span class="line">                &lt;el-form&gt;</span><br><span class="line">                    &lt;el-input</span><br><span class="line">                            placeholder&#x3D;&quot;手机号&quot;</span><br><span class="line">                            prefix-icon&#x3D;&quot;el-icon-phone-outline&quot;</span><br><span class="line">                            v-model&#x3D;&quot;mobile&quot;</span><br><span class="line">                            clearable</span><br><span class="line">                            @blur&#x3D;&quot;check_mobile&quot;&gt;</span><br><span class="line">                    &lt;&#x2F;el-input&gt;</span><br><span class="line">                    &lt;el-input</span><br><span class="line">                            placeholder&#x3D;&quot;密码&quot;</span><br><span class="line">                            prefix-icon&#x3D;&quot;el-icon-key&quot;</span><br><span class="line">                            v-model&#x3D;&quot;password&quot;</span><br><span class="line">                            clearable</span><br><span class="line">                            show-password&gt;</span><br><span class="line">                    &lt;&#x2F;el-input&gt;</span><br><span class="line">                    &lt;el-input</span><br><span class="line">                            placeholder&#x3D;&quot;验证码&quot;</span><br><span class="line">                            prefix-icon&#x3D;&quot;el-icon-chat-line-round&quot;</span><br><span class="line">                            v-model&#x3D;&quot;sms&quot;</span><br><span class="line">                            clearable&gt;</span><br><span class="line">                        &lt;template slot&#x3D;&quot;append&quot;&gt;</span><br><span class="line">                            &lt;span class&#x3D;&quot;sms&quot; @click&#x3D;&quot;send_sms&quot;&gt;&#123;&#123; sms_interval &#125;&#125;&lt;&#x2F;span&gt;</span><br><span class="line">                        &lt;&#x2F;template&gt;</span><br><span class="line">                    &lt;&#x2F;el-input&gt;</span><br><span class="line">                    &lt;el-button @click&#x3D;&quot;register&quot; type&#x3D;&quot;primary&quot;&gt;注册&lt;&#x2F;el-button&gt;</span><br><span class="line">                &lt;&#x2F;el-form&gt;</span><br><span class="line">                &lt;div class&#x3D;&quot;foot&quot;&gt;</span><br><span class="line">                    &lt;span @click&#x3D;&quot;go_login&quot;&gt;立即登录&lt;&#x2F;span&gt;</span><br><span class="line">                &lt;&#x2F;div&gt;</span><br><span class="line">            &lt;&#x2F;div&gt;</span><br><span class="line">        &lt;&#x2F;div&gt;</span><br><span class="line">    &lt;&#x2F;div&gt;</span><br><span class="line">&lt;&#x2F;template&gt;</span><br><span class="line"></span><br><span class="line">&lt;script&gt;</span><br><span class="line">    export default &#123;</span><br><span class="line">        name: &quot;Register&quot;,</span><br><span class="line">        data() &#123;</span><br><span class="line">            return &#123;</span><br><span class="line">                mobile: &#39;&#39;,</span><br><span class="line">                password: &#39;&#39;,</span><br><span class="line">                sms: &#39;&#39;,</span><br><span class="line">                sms_interval: &#39;获取验证码&#39;,</span><br><span class="line">                is_send: false,</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;,</span><br><span class="line">        methods: &#123;</span><br><span class="line">            close_register() &#123;</span><br><span class="line">                this.$emit(&#39;close&#39;, false)</span><br><span class="line">            &#125;,</span><br><span class="line">            go_login() &#123;</span><br><span class="line">                this.$emit(&#39;go&#39;)</span><br><span class="line">            &#125;,</span><br><span class="line">            check_mobile() &#123;</span><br><span class="line">                if (!this.mobile) return;</span><br><span class="line">                &#x2F;&#x2F; js正则：&#x2F;正则语法&#x2F;</span><br><span class="line">                &#x2F;&#x2F; &#39;字符串&#39;.match(&#x2F;正则语法&#x2F;)</span><br><span class="line">                if (!this.mobile.match(&#x2F;^1[3-9][0-9]&#123;9&#125;$&#x2F;)) &#123;</span><br><span class="line">                    this.$message(&#123;</span><br><span class="line">                        message: &#39;手机号有误&#39;,</span><br><span class="line">                        type: &#39;warning&#39;,</span><br><span class="line">                        duration: 1000,</span><br><span class="line">                        onClose: () &#x3D;&gt; &#123;</span><br><span class="line">                            this.mobile &#x3D; &#39;&#39;;</span><br><span class="line">                        &#125;</span><br><span class="line">                    &#125;);</span><br><span class="line">                    return false;</span><br><span class="line">                &#125;</span><br><span class="line">                &#x2F;&#x2F; 后台校验手机号是否已存在</span><br><span class="line">                this.$axios(&#123;</span><br><span class="line">                    url: this.$settings.base_url + &#39;&#x2F;user&#x2F;mobile&#x2F;&#39;,</span><br><span class="line">                    method: &#39;post&#39;,</span><br><span class="line">                    data: &#123;</span><br><span class="line">                        mobile: this.mobile</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;).then(response &#x3D;&gt; &#123;</span><br><span class="line">                    let result &#x3D; response.data.result;</span><br><span class="line">                    if (!result) &#123;</span><br><span class="line">                        this.$message(&#123;</span><br><span class="line">                            message: &#39;欢迎注册我们的平台&#39;,</span><br><span class="line">                            type: &#39;success&#39;,</span><br><span class="line">                            duration: 1500,</span><br><span class="line">                        &#125;);</span><br><span class="line">                        &#x2F;&#x2F; 发生验证码按钮才可以被点击</span><br><span class="line">                        this.is_send &#x3D; true;</span><br><span class="line">                    &#125; else &#123;</span><br><span class="line">                        this.$message(&#123;</span><br><span class="line">                            message: &#39;账号已存在，请直接登录&#39;,</span><br><span class="line">                            type: &#39;warning&#39;,</span><br><span class="line">                            duration: 1500,</span><br><span class="line">                        &#125;)</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;).catch(() &#x3D;&gt; &#123;&#125;);</span><br><span class="line">            &#125;,</span><br><span class="line">            send_sms() &#123;</span><br><span class="line">                &#x2F;&#x2F; this.is_send必须允许发生验证码，才可以往下执行逻辑</span><br><span class="line">                if (!this.is_send) return;</span><br><span class="line">                &#x2F;&#x2F; 按钮点一次立即禁用</span><br><span class="line">                this.is_send &#x3D; false;</span><br><span class="line"></span><br><span class="line">                let sms_interval_time &#x3D; 60;</span><br><span class="line">                this.sms_interval &#x3D; &quot;发送中...&quot;;</span><br><span class="line"></span><br><span class="line">                &#x2F;&#x2F; 定时器: setInterval(fn, time, args)</span><br><span class="line"></span><br><span class="line">                &#x2F;&#x2F; 往后台发送验证码</span><br><span class="line">                this.$axios(&#123;</span><br><span class="line">                    url: this.$settings.base_url + &#39;&#x2F;user&#x2F;sms&#x2F;&#39;,</span><br><span class="line">                    method: &#39;get&#39;,</span><br><span class="line">                    params: &#123;</span><br><span class="line">                        mobile: this.mobile</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;).then(response &#x3D;&gt; &#123;</span><br><span class="line">                    let result &#x3D; response.data.result;</span><br><span class="line">                    if (result) &#123; &#x2F;&#x2F; 发送成功</span><br><span class="line">                        let timer &#x3D; setInterval(() &#x3D;&gt; &#123;</span><br><span class="line">                            if (sms_interval_time &lt;&#x3D; 1) &#123;</span><br><span class="line">                                clearInterval(timer);</span><br><span class="line">                                this.sms_interval &#x3D; &quot;获取验证码&quot;;</span><br><span class="line">                                this.is_send &#x3D; true; &#x2F;&#x2F; 重新回复点击发送功能的条件</span><br><span class="line">                            &#125; else &#123;</span><br><span class="line">                                sms_interval_time -&#x3D; 1;</span><br><span class="line">                                this.sms_interval &#x3D; &#96;$&#123;sms_interval_time&#125;秒后再发&#96;;</span><br><span class="line">                            &#125;</span><br><span class="line">                        &#125;, 1000);</span><br><span class="line">                    &#125; else &#123;  &#x2F;&#x2F; 发送失败</span><br><span class="line">                        this.sms_interval &#x3D; &quot;重新获取&quot;;</span><br><span class="line">                        this.is_send &#x3D; true;</span><br><span class="line">                        this.$message(&#123;</span><br><span class="line">                            message: &#39;短信发送失败&#39;,</span><br><span class="line">                            type: &#39;warning&#39;,</span><br><span class="line">                            duration: 3000</span><br><span class="line">                        &#125;);</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;).catch(() &#x3D;&gt; &#123;</span><br><span class="line">                    this.sms_interval &#x3D; &quot;频率过快&quot;;</span><br><span class="line">                    this.is_send &#x3D; true;</span><br><span class="line">                &#125;)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">            &#125;,</span><br><span class="line">            register () &#123;</span><br><span class="line">                if (!(this.mobile &amp;&amp; this.sms &amp;&amp; this.password)) &#123;</span><br><span class="line">                    this.$message(&#123;</span><br><span class="line">                        message: &#39;请填好手机、密码与验证码&#39;,</span><br><span class="line">                        type: &#39;warning&#39;,</span><br><span class="line">                        duration: 1500</span><br><span class="line">                    &#125;);</span><br><span class="line">                    return false  &#x2F;&#x2F; 直接结束逻辑</span><br><span class="line">                &#125;</span><br><span class="line"></span><br><span class="line">                this.$axios(&#123;</span><br><span class="line">                    url: this.$settings.base_url + &#39;&#x2F;user&#x2F;register&#x2F;&#39;,</span><br><span class="line">                    method: &#39;post&#39;,</span><br><span class="line">                    data: &#123;</span><br><span class="line">                        mobile: this.mobile,</span><br><span class="line">                        code: this.sms,</span><br><span class="line">                        password: this.password</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;).then(response &#x3D;&gt; &#123;</span><br><span class="line">                    this.$message(&#123;</span><br><span class="line">                        message: &#39;注册成功，3秒跳转登录页面&#39;,</span><br><span class="line">                        type: &#39;success&#39;,</span><br><span class="line">                        duration: 3000,</span><br><span class="line">                        showClose: true,</span><br><span class="line">                        onClose: () &#x3D;&gt; &#123;</span><br><span class="line">                            &#x2F;&#x2F; 去向成功页面</span><br><span class="line">                            this.$emit(&#39;success&#39;)</span><br><span class="line">                        &#125;</span><br><span class="line">                    &#125;);</span><br><span class="line">                &#125;).catch(error &#x3D;&gt; &#123;</span><br><span class="line">                    this.$message(&#123;</span><br><span class="line">                        message: &#39;注册失败，请重新注册&#39;,</span><br><span class="line">                        type: &#39;warning&#39;,</span><br><span class="line">                        duration: 1500,</span><br><span class="line">                        showClose: true,</span><br><span class="line">                        onClose: () &#x3D;&gt; &#123;</span><br><span class="line">                            &#x2F;&#x2F; 清空所有输入框</span><br><span class="line">                            this.mobile &#x3D; &#39;&#39;;</span><br><span class="line">                            this.password &#x3D; &#39;&#39;;</span><br><span class="line">                            this.sms &#x3D; &#39;&#39;;</span><br><span class="line">                        &#125;</span><br><span class="line">                    &#125;);</span><br><span class="line">                &#125;)</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&lt;&#x2F;script&gt;</span><br><span class="line"></span><br><span class="line">&lt;style scoped&gt;</span><br><span class="line">    .register &#123;</span><br><span class="line">        width: 100vw;</span><br><span class="line">        height: 100vh;</span><br><span class="line">        position: fixed;</span><br><span class="line">        top: 0;</span><br><span class="line">        left: 0;</span><br><span class="line">        z-index: 10;</span><br><span class="line">        background-color: rgba(0, 0, 0, 0.3);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .box &#123;</span><br><span class="line">        width: 400px;</span><br><span class="line">        height: 480px;</span><br><span class="line">        background-color: white;</span><br><span class="line">        border-radius: 10px;</span><br><span class="line">        position: relative;</span><br><span class="line">        top: calc(50vh - 240px);</span><br><span class="line">        left: calc(50vw - 200px);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .el-icon-close &#123;</span><br><span class="line">        position: absolute;</span><br><span class="line">        font-weight: bold;</span><br><span class="line">        font-size: 20px;</span><br><span class="line">        top: 10px;</span><br><span class="line">        right: 10px;</span><br><span class="line">        cursor: pointer;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .el-icon-close:hover &#123;</span><br><span class="line">        color: darkred;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .content &#123;</span><br><span class="line">        position: absolute;</span><br><span class="line">        top: 40px;</span><br><span class="line">        width: 280px;</span><br><span class="line">        left: 60px;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .nav &#123;</span><br><span class="line">        font-size: 20px;</span><br><span class="line">        height: 38px;</span><br><span class="line">        border-bottom: 2px solid darkgrey;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .nav &gt; span &#123;</span><br><span class="line">        margin-left: 90px;</span><br><span class="line">        color: darkgrey;</span><br><span class="line">        user-select: none;</span><br><span class="line">        cursor: pointer;</span><br><span class="line">        padding-bottom: 10px;</span><br><span class="line">        border-bottom: 2px solid darkgrey;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .nav &gt; span.active &#123;</span><br><span class="line">        color: black;</span><br><span class="line">        border-bottom: 3px solid black;</span><br><span class="line">        padding-bottom: 9px;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .el-input, .el-button &#123;</span><br><span class="line">        margin-top: 40px;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .el-button &#123;</span><br><span class="line">        width: 100%;</span><br><span class="line">        font-size: 18px;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .foot &gt; span &#123;</span><br><span class="line">        float: right;</span><br><span class="line">        margin-top: 20px;</span><br><span class="line">        color: orange;</span><br><span class="line">        cursor: pointer;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .sms &#123;</span><br><span class="line">        color: orange;</span><br><span class="line">        cursor: pointer;</span><br><span class="line">        display: inline-block;</span><br><span class="line">        width: 70px;</span><br><span class="line">        text-align: center;</span><br><span class="line">        user-select: none;</span><br><span class="line">    &#125;</span><br><span class="line">&lt;&#x2F;style&gt;</span><br></pre></td></tr></table></figure>

<h5 id="Header-vue"><a href="#Header-vue" class="headerlink" title="Header.vue"></a>Header.vue</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br></pre></td><td class="code"><pre><span class="line">&lt;template&gt;</span><br><span class="line">    &lt;div class&#x3D;&quot;header&quot;&gt;</span><br><span class="line">        &lt;div class&#x3D;&quot;slogan&quot;&gt;</span><br><span class="line">            &lt;p&gt;老男孩IT教育 | 帮助有志向的年轻人通过努力学习获得体面的工作和生活&lt;&#x2F;p&gt;</span><br><span class="line">        &lt;&#x2F;div&gt;</span><br><span class="line">        &lt;div class&#x3D;&quot;nav&quot;&gt;</span><br><span class="line">            &lt;ul class&#x3D;&quot;left-part&quot;&gt;</span><br><span class="line">                &lt;li class&#x3D;&quot;logo&quot;&gt;</span><br><span class="line">                    &lt;router-link to&#x3D;&quot;&#x2F;&quot;&gt;</span><br><span class="line">                        &lt;img src&#x3D;&quot;..&#x2F;assets&#x2F;img&#x2F;head-logo.svg&quot; alt&#x3D;&quot;&quot;&gt;</span><br><span class="line">                    &lt;&#x2F;router-link&gt;</span><br><span class="line">                &lt;&#x2F;li&gt;</span><br><span class="line">                &lt;li class&#x3D;&quot;ele&quot;&gt;</span><br><span class="line">                    &lt;span @click&#x3D;&quot;goPage(&#39;&#x2F;free-course&#39;)&quot; :class&#x3D;&quot;&#123;active: url_path &#x3D;&#x3D;&#x3D; &#39;&#x2F;free-course&#39;&#125;&quot;&gt;免费课&lt;&#x2F;span&gt;</span><br><span class="line">                &lt;&#x2F;li&gt;</span><br><span class="line">                &lt;li class&#x3D;&quot;ele&quot;&gt;</span><br><span class="line">                    &lt;span @click&#x3D;&quot;goPage(&#39;&#x2F;actual-course&#39;)&quot; :class&#x3D;&quot;&#123;active: url_path &#x3D;&#x3D;&#x3D; &#39;&#x2F;actual-course&#39;&#125;&quot;&gt;实战课&lt;&#x2F;span&gt;</span><br><span class="line">                &lt;&#x2F;li&gt;</span><br><span class="line">                &lt;li class&#x3D;&quot;ele&quot;&gt;</span><br><span class="line">                    &lt;span @click&#x3D;&quot;goPage(&#39;&#x2F;light-course&#39;)&quot; :class&#x3D;&quot;&#123;active: url_path &#x3D;&#x3D;&#x3D; &#39;&#x2F;light-course&#39;&#125;&quot;&gt;轻课&lt;&#x2F;span&gt;</span><br><span class="line">                &lt;&#x2F;li&gt;</span><br><span class="line">            &lt;&#x2F;ul&gt;</span><br><span class="line"></span><br><span class="line">            &lt;div class&#x3D;&quot;right-part&quot;&gt;</span><br><span class="line">                &lt;div v-if&#x3D;&quot;!token&quot;&gt;</span><br><span class="line">                    &lt;span @click&#x3D;&quot;put_login&quot;&gt;登录&lt;&#x2F;span&gt;</span><br><span class="line">                    &lt;span class&#x3D;&quot;line&quot;&gt;|&lt;&#x2F;span&gt;</span><br><span class="line">                    &lt;span @click&#x3D;&quot;put_register&quot;&gt;注册&lt;&#x2F;span&gt;</span><br><span class="line">                &lt;&#x2F;div&gt;</span><br><span class="line">                &lt;div v-else&gt;</span><br><span class="line">                    &lt;span&gt;&#123;&#123; username &#125;&#125;&lt;&#x2F;span&gt;</span><br><span class="line">                    &lt;span class&#x3D;&quot;line&quot;&gt;|&lt;&#x2F;span&gt;</span><br><span class="line">                    &lt;span @click&#x3D;&quot;logout&quot;&gt;注销&lt;&#x2F;span&gt;</span><br><span class="line">                &lt;&#x2F;div&gt;</span><br><span class="line">    		&lt;&#x2F;div&gt;</span><br><span class="line">        &lt;&#x2F;div&gt;</span><br><span class="line">        &lt;Login v-if&#x3D;&quot;is_login&quot; @close&#x3D;&quot;close_login&quot; @go&#x3D;&quot;put_register&quot; @success&#x3D;&quot;success_login&quot; &#x2F;&gt;</span><br><span class="line">        &lt;Register v-if&#x3D;&quot;is_register&quot; @close&#x3D;&quot;close_register&quot; @go&#x3D;&quot;put_login&quot; @success&#x3D;&quot;success_register&quot; &#x2F;&gt;</span><br><span class="line">    &lt;&#x2F;div&gt;</span><br><span class="line">&lt;&#x2F;template&gt;</span><br><span class="line"></span><br><span class="line">&lt;script&gt;</span><br><span class="line">    import Login from &#39;.&#x2F;Login&#39;</span><br><span class="line">    import Register from &quot;.&#x2F;Register&quot;</span><br><span class="line"></span><br><span class="line">    export default &#123;</span><br><span class="line">        name: &quot;Header&quot;,</span><br><span class="line">        data() &#123;</span><br><span class="line">            return &#123;</span><br><span class="line">                url_path: sessionStorage.url_path || &#39;&#x2F;&#39;,</span><br><span class="line">                token: &#39;&#39;,</span><br><span class="line">                username: &#39;&#39;,</span><br><span class="line">                user_id: &#39;&#39;,</span><br><span class="line">                is_login: false,</span><br><span class="line">                is_register: false,</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;,</span><br><span class="line">        methods: &#123;</span><br><span class="line">            goPage(url_path) &#123;</span><br><span class="line">                &#x2F;&#x2F; 已经是当前路由就没有必要重新跳转</span><br><span class="line">                if (this.url_path !&#x3D;&#x3D; url_path) &#123;</span><br><span class="line">                    this.$router.push(url_path);</span><br><span class="line">                &#125;</span><br><span class="line">                sessionStorage.url_path &#x3D; url_path;</span><br><span class="line">            &#125;,</span><br><span class="line">            put_login() &#123;</span><br><span class="line">                this.is_login &#x3D; true;</span><br><span class="line">                this.is_register &#x3D; false;</span><br><span class="line">            &#125;,</span><br><span class="line">            put_register() &#123;</span><br><span class="line">                this.is_login &#x3D; false;</span><br><span class="line">                this.is_register &#x3D; true;</span><br><span class="line">            &#125;,</span><br><span class="line">            close_login() &#123;</span><br><span class="line">                this.is_login &#x3D; false;</span><br><span class="line">            &#125;,</span><br><span class="line">            close_register() &#123;</span><br><span class="line">                this.is_register &#x3D; false;</span><br><span class="line">            &#125;,</span><br><span class="line">            success_login(data) &#123;</span><br><span class="line">                this.is_login &#x3D; false;</span><br><span class="line">                this.username &#x3D; data.username;</span><br><span class="line">                this.token &#x3D; data.token;</span><br><span class="line">                this.user_id &#x3D; data.user_id;</span><br><span class="line">            &#125;,</span><br><span class="line">            logout() &#123;</span><br><span class="line">                this.token &#x3D; &#39;&#39;;</span><br><span class="line">                this.username &#x3D; &#39;&#39;;</span><br><span class="line">                this.user_id &#x3D; &#39;&#39;;</span><br><span class="line">                this.$cookies.remove(&#39;username&#39;);</span><br><span class="line">                this.$cookies.remove(&#39;token&#39;);</span><br><span class="line">                this.$cookies.remove(&#39;user_id&#39;);</span><br><span class="line">            &#125;,</span><br><span class="line">            success_register () &#123;</span><br><span class="line">                this.is_register &#x3D; false;</span><br><span class="line">                this.is_login &#x3D; true;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;,</span><br><span class="line">        created() &#123;</span><br><span class="line">            sessionStorage.url_path &#x3D; this.$route.path;</span><br><span class="line">            this.url_path &#x3D; this.$route.path;</span><br><span class="line"></span><br><span class="line">            &#x2F;&#x2F; 检测cookies，查看登录状态</span><br><span class="line">            this.username &#x3D; this.$cookies.get(&#39;username&#39;);</span><br><span class="line">            this.token &#x3D; this.$cookies.get(&#39;token&#39;);</span><br><span class="line">            this.user_id &#x3D; this.$cookies.get(&#39;user_id&#39;);</span><br><span class="line">        &#125;,</span><br><span class="line">        components: &#123;</span><br><span class="line">            Login,</span><br><span class="line">            Register,</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&lt;&#x2F;script&gt;</span><br><span class="line"></span><br><span class="line">&lt;style scoped&gt;</span><br><span class="line">    .header &#123;</span><br><span class="line">        background-color: white;</span><br><span class="line">        box-shadow: 0 0 5px 0 #aaa;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .header:after &#123;</span><br><span class="line">        content: &quot;&quot;;</span><br><span class="line">        display: block;</span><br><span class="line">        clear: both;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .slogan &#123;</span><br><span class="line">        background-color: #eee;</span><br><span class="line">        height: 40px;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .slogan p &#123;</span><br><span class="line">        width: 1200px;</span><br><span class="line">        margin: 0 auto;</span><br><span class="line">        color: #aaa;</span><br><span class="line">        font-size: 13px;</span><br><span class="line">        line-height: 40px;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .nav &#123;</span><br><span class="line">        background-color: white;</span><br><span class="line">        user-select: none;</span><br><span class="line">        width: 1200px;</span><br><span class="line">        margin: 0 auto;</span><br><span class="line"></span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .nav ul &#123;</span><br><span class="line">        padding: 15px 0;</span><br><span class="line">        float: left;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .nav ul:after &#123;</span><br><span class="line">        clear: both;</span><br><span class="line">        content: &#39;&#39;;</span><br><span class="line">        display: block;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .nav ul li &#123;</span><br><span class="line">        float: left;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .logo &#123;</span><br><span class="line">        margin-right: 20px;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .ele &#123;</span><br><span class="line">        margin: 0 20px;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .ele span &#123;</span><br><span class="line">        display: block;</span><br><span class="line">        font: 15px&#x2F;36px &#39;微软雅黑&#39;;</span><br><span class="line">        border-bottom: 2px solid transparent;</span><br><span class="line">        cursor: pointer;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .ele span:hover &#123;</span><br><span class="line">        border-bottom-color: orange;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .ele span.active &#123;</span><br><span class="line">        color: orange;</span><br><span class="line">        border-bottom-color: orange;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .right-part &#123;</span><br><span class="line">        float: right;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .right-part .line &#123;</span><br><span class="line">        margin: 0 10px;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    .right-part span &#123;</span><br><span class="line">        line-height: 68px;</span><br><span class="line">        cursor: pointer;</span><br><span class="line">    &#125;</span><br><span class="line">&lt;&#x2F;style&gt;</span><br></pre></td></tr></table></figure>

</section>
    <!-- Tags START -->
    
    <!-- Tags END -->
    <!-- NAV START -->
    
  <div class="nav-container">
    <!-- reverse left and right to put prev and next in a more logic postition -->
    
      <a class="nav-left" href="/python/%E8%B7%AF%E9%A3%9E%E9%A1%B9%E7%9B%AE/3-%E7%99%BB%E5%BD%95%E6%B3%A8%E5%86%8C/7-%E7%9F%AD%E4%BF%A1%E6%B3%A8%E5%86%8C%E6%8E%A5%E5%8F%A3/">
        <span class="nav-arrow">← </span>
        
          python/路飞项目/3-登录注册/7-短信注册接口
        
      </a>
    
    
      <a class="nav-right" href="/python/%E8%B7%AF%E9%A3%9E%E9%A1%B9%E7%9B%AE/4-redis/1-redis%E6%93%8D%E4%BD%9C/">
        
          python/路飞项目/4-redis/1-redis操作
        
        <span class="nav-arrow"> →</span>
      </a>
    
  </div>

    <!-- NAV END -->
    <!-- 打赏 START -->
    
      <div class="money-like">
        <div class="reward-btn">
          赏
          <span class="money-code">
            <span class="alipay-code">
              <div class="code-image"></div>
              <b>使用支付宝打赏</b>
            </span>
            <span class="wechat-code">
              <div class="code-image"></div>
              <b>使用微信打赏</b>
            </span>
          </span>
        </div>
        <p class="notice">点击上方按钮,请我喝杯咖啡！</p>
      </div>
    
    <!-- 打赏 END -->
    <!-- 二维码 START -->
    
      <div class="qrcode">
        <canvas id="share-qrcode"></canvas>
        <p class="notice">扫描二维码，分享此文章</p>
      </div>
    
    <!-- 二维码 END -->
    
      <!-- Gitment START -->
      <div id="comments"></div>
      <!-- Gitment END -->
    
  </article>
  <!-- Article END -->
  <!-- Catalog START -->
  
    <aside class="catalog-container">
  <div class="toc-main">
  <!-- 不蒜子统计 -->
    <strong class="toc-title">目录</strong>
    
      <ol class="toc-nav"><li class="toc-nav-item toc-nav-level-2"><a class="toc-nav-link" href="#前台"><span class="toc-nav-text">前台</span></a><ol class="toc-nav-child"><li class="toc-nav-item toc-nav-level-5"><a class="toc-nav-link" href="#Login-vue"><span class="toc-nav-text">Login.vue</span></a></li><li class="toc-nav-item toc-nav-level-5"><a class="toc-nav-link" href="#Register-vue"><span class="toc-nav-text">Register.vue</span></a></li><li class="toc-nav-item toc-nav-level-5"><a class="toc-nav-link" href="#Header-vue"><span class="toc-nav-text">Header.vue</span></a></li></ol></li></ol></li></ol></li></ol>
    
  </div>
</aside>
  
  <!-- Catalog END -->
</main>

<script>
  (function () {
    var url = 'http://www.liuqingzheng.top/python/路飞项目/3-登录注册/8-前台登录注册修订/';
    var banner = ''
    if (banner !== '' && banner !== 'undefined' && banner !== 'null') {
      $('#article-banner').css({
        'background-image': 'url(' + banner + ')'
      })
    } else {
      $('#article-banner').geopattern(url)
    }
    $('.header').removeClass('fixed-header')

    // error image
    $(".markdown-content img").on('error', function() {
      $(this).attr('src', 'http://file.muyutech.com/error-img.png')
      $(this).css({
        'cursor': 'default'
      })
    })

    // zoom image
    $(".markdown-content img").on('click', function() {
      var src = $(this).attr('src')
      if (src !== 'http://file.muyutech.com/error-img.png') {
        var imageW = $(this).width()
        var imageH = $(this).height()

        var zoom = ($(window).width() * 0.95 / imageW).toFixed(2)
        zoom = zoom < 1 ? 1 : zoom
        zoom = zoom > 2 ? 2 : zoom
        var transY = (($(window).height() - imageH) / 2).toFixed(2)

        $('body').append('<div class="image-view-wrap"><div class="image-view-inner"><img src="'+ src +'" /></div></div>')
        $('.image-view-wrap').addClass('wrap-active')
        $('.image-view-wrap img').css({
          'width': `${imageW}`,
          'transform': `translate3d(0, ${transY}px, 0) scale3d(${zoom}, ${zoom}, 1)`
        })
        $('html').css('overflow', 'hidden')

        $('.image-view-wrap').on('click', function() {
          $(this).remove()
          $('html').attr('style', '')
        })
      }
    })
  })();
</script>


  <script>
    var qr = new QRious({
      element: document.getElementById('share-qrcode'),
      value: document.location.href
    });
  </script>



  <script>
    var gitmentConfig = "liuqingzheng";
    if (gitmentConfig !== 'undefined') {
      var gitment = new Gitment({
        id: "python/路飞项目/3-登录注册/8-前台登录注册修订",
        owner: "liuqingzheng",
        repo: "FuckBlog",
        oauth: {
          client_id: "32a4076431cf39d0ecea",
          client_secret: "94484bd79b3346a949acb2fda3c8a76ce16990c6"
        },
        theme: {
          render(state, instance) {
            const container = document.createElement('div')
            container.lang = "en-US"
            container.className = 'gitment-container gitment-root-container'
            container.appendChild(instance.renderHeader(state, instance))
            container.appendChild(instance.renderEditor(state, instance))
            container.appendChild(instance.renderComments(state, instance))
            container.appendChild(instance.renderFooter(state, instance))
            return container;
          }
        }
      })
      gitment.render(document.getElementById('comments'))
    }
  </script>




    <div class="scroll-top">
  <span class="arrow-icon"></span>
</div>
    <footer class="app-footer">
<!-- 不蒜子统计 -->
<span id="busuanzi_container_site_pv">
     本站总访问量<span id="busuanzi_value_site_pv"></span>次
</span>
<span class="post-meta-divider">|</span>
<span id="busuanzi_container_site_uv" style='display:none'>
     本站访客数<span id="busuanzi_value_site_uv"></span>人
</span>
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>



  <p class="copyright">
    &copy; 2021 | Proudly powered by <a href="https://www.cnblogs.com/xiaoyuanqujing" target="_blank">小猿取经</a>
    <br>
    Theme by <a href="https://www.cnblogs.com/xiaoyuanqujing" target="_blank" rel="noopener">小猿取经</a>
  </p>
</footer>

<script>
  function async(u, c) {
    var d = document, t = 'script',
      o = d.createElement(t),
      s = d.getElementsByTagName(t)[0];
    o.src = u;
    if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
    s.parentNode.insertBefore(o, s);
  }
</script>
<script>
  async("//cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js", function(){
    FastClick.attach(document.body);
  })
</script>

<script>
  var hasLine = 'true';
  async("//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js", function(){
    $('figure pre').each(function(i, block) {
      var figure = $(this).parents('figure');
      if (hasLine === 'false') {
        figure.find('.gutter').hide();
      }
      var lang = figure.attr('class').split(' ')[1] || 'code';
      var codeHtml = $(this).html();
      var codeTag = document.createElement('code');
      codeTag.className = lang;
      codeTag.innerHTML = codeHtml;
      $(this).attr('class', '').empty().html(codeTag);
      figure.attr('data-lang', lang.toUpperCase());
      hljs.highlightBlock(block);
    });
  })
</script>





<!-- Baidu Tongji -->

<script>
    var _baId = 'c5fd96eee1193585be191f318c3fa725';
    // Originial
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "//hm.baidu.com/hm.js?" + _baId;
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
</script>


<script src="/js/script.js"></script>


<script src="/js/search.js"></script>


<script src="/js/load.js"></script>



  <span class="local-search local-search-google local-search-plugin" style="right: 50px;top: 70px;;position:absolute;z-index:2;">
      <input type="search" placeholder="站内搜索" id="local-search-input" class="local-search-input-cls" style="">
      <div id="local-search-result" class="local-search-result-cls"></div>
  </span>


  </body>
</html>